package com.designpatternspart2.structuraldesignpatterns.proxypattern;

import java.util.Date;

/**
 *
 * @author Lance
 */
public class Proxy
{

    private SlowThing slowThing;

    public Proxy()
    {
        System.out.println("Creating proxy at " + new Date());
    }

    public void sayHello()
    {
        if (getSlowThing() == null)
        {
            setSlowThing(new SlowThing());
        }
        getSlowThing().sayHello();
    }

    public SlowThing getSlowThing()
    {
        return slowThing;
    }

    public void setSlowThing(SlowThing slowThing)
    {
        this.slowThing = slowThing;
    }
}
